package sala.commonmovie.textmanager 
{
	import flash.display.MovieClip;
	import flash.text.TextField;
	import gs.TweenLite; 
	import sala.events.TextTweenEvent; 
	
	/**
	 * ...
	 * @author zacess
	 */
	public class TextContainer extends MovieClip
	{
		public var messageTf:TextField; 
		
		public function TextContainer() 
		{
			
		}
		
		public function tweenIn():void
		{
			TweenLite.to(this, 0.5, { x:30, y:214, onComplete:tweenInOnCompleteHdl } );  
		}
		
		public function showNextText():void
		{
			TweenLite.to(this, 0.5, { x: 287, y:214,onComplete:tweenOutOnCompleteHdl} ); 
		}
		
		public function tweenInOnCompleteHdl():void 
		{
			//trace("The tween has finished!");
			var evt:TextTweenEvent = new TextTweenEvent (TextTweenEvent.TWEEN_IN_COMPLETE); 
			dispatchEvent(evt); 
		}
		
		public function tweenOutOnCompleteHdl():void
		{
			//trace("The tween out has finished!");
			var evt:TextTweenEvent = new TextTweenEvent(TextTweenEvent.TWEEN_OUT_COMPLETE); 
			dispatchEvent(evt); 
			
			this.x = -257; 
			tweenIn(); 
		}
		
		public function setText(text:String):void
		{
			this.messageTf.text = text; 
			this.messageTf.height = this.messageTf.textHeight + 10;
		}
		
	}

}